<?php

class testController extends AppController
{
    private $orderId = 'QIAO-201804130039';
    public function send_parameterAction(){
        $sfe = new SFExpressClass(true);
        $orderid = $this->orderId;
        $express_type = '1';
        $j_province = '上海市';
        $j_city = '上海市';
        $j_company = '顺丰镖局';
        $j_contact = 'Ethan';
        $j_tel = '15012345678';
        $j_address = '迎宾大道222号';
        $d_province = '上海市';
        $d_city = '上海市';
        $d_county = '奉贤区';
        $d_company = '神罗科技';
        $d_contact = '风一样的旭哥';
        $d_tel = '13585578641';
        $d_address = '宝芝林大厦701室';
        $parcel_quantity = '1';
        $pay_method = '3';
        $cargo = 'iphone 7 plus';
        $info = $sfe ->parameter($orderid,$express_type,$j_province,$j_city,$j_company,$j_contact,$j_tel,$j_address,$d_province,$d_city,$d_county,$d_company,$d_contact,$d_tel,$d_address,$parcel_quantity,$pay_method,$cargo);
        echo '<pre>';
        var_dump($info);
    }


    /**
     * 查询订单
     */
    public function get_queryAction(){
        $sfe = new SFExpressClass(true);
        $orderid = $this->orderId;
        $queryInfo = $sfe ->query($orderid);
        echo '<pre>';
        var_dump($queryInfo);
    }

    /**
     * 取消订单
     */
    public function cancelAction(){
        $sfe = new SFExpressClass(true);
        $orderid = $this->orderId;
        $queryInfo = $sfe ->cancel($orderid);
        echo '<pre>';
        var_dump($queryInfo);
    }


    /**
     * 获取订单路由推送信息     丰桥配置text发送
     *  请求方法为"text"时,客户可直接从请求的数据流中得到相应的XML。 在客户处理XML信息后，向顺丰系统返回响应XML报文，响应XML报文结果只能为OK/ERR（参见XML报文说明），顺丰系统将重新推送此次交易的所有信息
     */
    public function getInfoAction(){
        $result = file_get_contents('php://input');
        $xml = simplexml_load_string($result, "SimpleXMLElement", LIBXML_NOCDATA);
        $json = json_encode($xml);
        $array = json_decode($json,TRUE);
        echo '<pre>';
        var_dump($array);
    }

    /**
     * 获取订单推送信息
     */
    public function getOrderInfoAction(){
        $result = file_get_contents('php://input');
        $xml = simplexml_load_string($result, "SimpleXMLElement", LIBXML_NOCDATA);
        $json = json_encode($xml);
        $array = json_decode($json,TRUE);
        echo '<pre>';
        var_dump($array);
    }

}
